// 员工模块

import requests from '@/utils/request'

// 导出获取员工列表
export const getEmployeeAPI = (params) => {
  return requests({ url: '/sys/user', params })
}

// 导出下载员工excel
export const exportAPI = () => {
  return requests({
    url: '/sys/user/export',
    responseType: 'blob' // 设置需要接收的数据类型
  })
}

// 导出下载员工模块excel
export const getTemplateAPI = (params) => {
  return requests({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

// 导出上传文件api
export const uploadingAPI = (data) => {
  return requests({
    url: '/sys/user/import',
    method: 'post',
    data
  })
}

// 导出删除员工api
export const delEmployeeAPI = (id) => {
  return requests({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// 导出新增员工接口
export const addEmployeeAPI = (data) => {
  return requests({ url: '/sys/user', method: 'post', data })
}

// 导出新增员工接口
export const upDateEmployeeAPI = (data) => {
  return requests({ url: '/sys/user/' + data.id, method: 'put', data })
}

// 导出获取单个员工基本信息
export const getEmployeeDetailAPI = (id) => {
  return requests({ url: '/sys/user/' + id })
}

// 导出分配员工角色列表
export const getEnabledListAPI = () => {
  return requests({ url: '/sys/role/list/enabled' })
}

// 导出分配员工角色
export const assignPolesAPI = (data) => {
  return requests({ url: '/sys/user/assignRoles', method: 'put', data })
}

